<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>inweo.utils.dnd test</title>
		<script src="../lib/mootools.js"></script>
		<script src="../inweo.js"></script>
		<script type="text/javascript">
			function main() {
				inweo.require("box");
				inweo.require("label");
				inweo.require("dnd", "utils");
				
				var vbox = new inweo.widgets.vbox(this);
				vbox.space(10);

				var label = new inweo.widgets.label();
				label.text("first draggable text");
				vbox.pack(label);

				var drag = new inweo.utils.dnd.dragSource(label);
				drag.data("label", label);
				drag.start();

				var label2 = new inweo.widgets.label();
				label2.text("second draggable text");
				vbox.pack(label2);

				var drag2 = new inweo.utils.dnd.dragSource(label2);
				drag2.data("text", " - second label");
				drag2.start();

				var label3 = new inweo.widgets.label();
				label3.text("empty text");
				vbox.pack(label3);

				var drop = new inweo.utils.dnd.dropTarget(label3);
				drop.accept(["label", "text"]);
				drop.onDrop(function() {
					var text = "";
					this.selected.each(function(selected) {
						if (selected.type == "label") {
							text += selected.data.text();
						} else if (selected.type == "text") {
							text += selected.data;
						}
					});
					if (text != "") {
						label3.text(text);
					}
				});
				drop.start();
			}
		</script>
	</head>
	<body>
	</body>
</html>